#include <iostream>
#include <queue>
#include <cstring>
#include <unordered_map>

using namespace std;

const int N = 362880 + 5;
typedef pair<string,string>PSS;

int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
char change[] = {'u', 'r', 'd', 'l'};

string bfs(string s){
    unordered_map<string, bool>mp;
    queue<PSS>q;
    string end = "12345678x";   //记录结束状态
    mp[s] = true;  
    q.push({s,""});
    while(q.size()){
        PSS t = q.front();
        q.pop();
        if(t.first == end)    return t.second;
        int pos = t.first.find('x');
        int x = pos / 3, y = pos % 3;
        for(int i = 0; i < 4; i ++ ){
            int a = x + dx[i], b = y + dy[i];
            if(a >= 0 && a < 3 && b >= 0 && b < 3){ 
                swap(t.first[a * 3 + b], t.first[pos]);
                if(!mp.count(t.first)){
                	string tem = t.second + change[i];
                	mp[t.first] = true;
                    q.push({t.first, tem});
                }
                swap(t.first[a * 3 + b], t.first[pos]); //恢复现场
            }
        }
    }
    return "unsolvable";
}

int main(){
    string s;
    for(int i = 0; i < 9; i ++ ){
        char c;
        cin>>c;
        s += c;
    }
    cout<<bfs(s);
    return 0;
}
